<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../home.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui">

    
    <ui:define name="content">
        <div class="col-lg-12">
            <h3 class="page-header" id="comercio">
                Administracion de 
                <h:outputText value="Almacén" style="color:#00BFFF;" />
                <h:link value="Regresar a Listado" outcome="list.xhtml" styleClass="pull-right" style="font-size: 16px; margin-right: 30px;"  />
            </h3>
        </div>

        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-primary">
                    <h:messages id="msg" globalOnly="true" styleClass="list-group" infoClass="list-group-item list-group-item-success"
                                errorClass="list-group-item list-group-item-danger" />
                    <div class="panel-heading" style="font-weight: bold;" >Actualizar al Almacen</div>
                    <div class="panel-body">
                        <div class="row" id="modificarComercio">
                            <div class="col-lg-8 col-lg-offset-1">
                                <h:form id="frmRegistrarProducto" styleClass="form-horizontal" >
                                    <f:event type="preRenderView" listener="#{almacenBean.initUpdate()}" />
                                    <div class="form-group has-feedback">
                                        <label for="Tipo" class="col-sm-5 control-label" style="text-align: right;">Tipo de Producto :</label>
                                        <div class="col-sm-6">
                                            <p:selectOneMenu id="bprod" value="#{almacenBean.producto.flag}" style="width: 100%;" >
                                                <f:selectItem  itemValue="true" itemLabel="Articulo"/>
                                                <f:selectItem  itemValue="false" itemLabel="Comida" />

                                          <!--      <f:ajax event="change" render="producto" listener="#{almacenBean.cambiarProducto}"></f:ajax>-->
                                            </p:selectOneMenu>
                                            <span class="glyphicon-remove form-control-feedback">
                                                <i  style="color: red;font-size: 20px;font-weight: bold;">*</i>
                                            </span>
                                        </div>					
                                    </div>

                                    <div class="form-group has-feedback">
                                        <label for="Producto" class="col-sm-5 control-label" style="text-align: right;">Producto :</label>
                                        <div class="col-sm-6">
                                            <p:selectOneMenu id="producto" value="#{almacenBean.producto.id}" style="width: 100%;" >
                                                <f:selectItem noSelectionOption="true" itemLabel="Seleccionar" itemValue="0" />
                                                <f:selectItems value="#{almacenBean.productos}" var="list" itemLabel="#{list.nombre}" itemValue="#{list.id}" >

                                                </f:selectItems>
                                                        
                                            </p:selectOneMenu>
                                            <span class="glyphicon-remove form-control-feedback">
                                                <i  style="color: red;font-size: 20px;font-weight: bold;">*</i>
                                            </span>
                                        </div>				    
                                    </div>
                                    <div class="form-group has-feedback">
                                        <label for="Cantidad" class="col-sm-5 control-label" style="text-align: right;">Cantidad :</label>
                                        <div class="col-sm-5">
                                            <p:inputMask id="dni" styleClass="form-control" value="#{almacenBean.almacen.cantidad}" mask="9?9999999" placeHolder="" />
                                            <span class="glyphicon-remove form-control-feedback">
                                                <i  style="color: red;font-size: 20px;font-weight: bold;">*</i>
                                            </span>
                                        </div>						

                                    </div>
                                    <div class="form-group has-feedback">
                                        <label for="Tipo" class="col-sm-5 control-label" style="text-align: right;">Unidad de Medida :</label>
                                        <div class="col-sm-6">
                                            <p:selectOneMenu value="#{almacenBean.almacen.unidadmedida}" style="width: 100%;" >
                                                <f:selectItem  itemValue="kg." itemLabel="Kilogramos"/>
                                                <f:selectItem  itemValue="unidad" itemLabel="unidad(es)" />
                                                <f:selectItem  itemValue="metros" itemLabel="metros"/>
                                                <f:selectItem  itemValue="litros" itemLabel="litro(s)" />


                                            </p:selectOneMenu>
                                            <span class="glyphicon-remove form-control-feedback">
                                                <i  style="color: red;font-size: 20px;font-weight: bold;">*</i>
                                            </span>
                                        </div>					
                                    </div>
                                    
                                    
                                   
                                  <!--  <div class="form-group has-feedback">
                                        <label for="Tipo" class="col-sm-5 control-label" style="text-align: right;">Tipo de Producto :</label>
                                        <div class="col-sm-6">
                                            <p:selectOneMenu value="#{almacenBean.almacen.estado}" style="width: 100%;" >
                                                <f:selectItem  itemValue="true" itemLabel="Perecible"/>
                                                <f:selectItem  itemValue="false" itemLabel="No Perecible" />


                                            </p:selectOneMenu>
                                            <span class="glyphicon-remove form-control-feedback">
                                                <i  style="color: red;font-size: 20px;font-weight: bold;">*</i>
                                            </span>
                                        </div>					
                                    </div>-->
                                    
                                    <div class="form-group">
                                        <div class="col-sm-2"></div>
                                        <div class="col-sm-8">
                                            <code>(*) Campos obligatorios</code>
                                        </div>
                                    </div>
                                    <p:commandButton value="Actualizar" styleClass="btn btn-primary" actionListener="#{almacenBean.actualizaralmacen}" update="@form :msg"/>

                                </h:form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </ui:define>


</ui:composition>
